<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace model;

/**
 * Description of TblShop
 *
 * @author Damian
 */
class TblShop extends Model{
    /**
     * @readwrite
     * @column
     * @primary
     * @type int
     * @length 11
     */
    public $ShopID;
    const ID="ShopID";
    /**
     * @readwrite
     * @column
     * @type varchar
     * @length 100
     * @validate required, min(5), max(100), alpha
     */
    public $Name;
    const NAME="Name";
    /**
     * @readwrite
     * @var TblSeller <p>sprzedawca z danego sklepu</p>
     */
    public $SellerID;
    const SELLER_ID="SellerID";
    /**
     * @readwrite
     * @column
     * @type text
     * @validate required
     */
    public $Description;
    const DESCRIPTION="Description";
    /**
     * @readwrite
     * @column
     * @type text
     */
    public $URL;
    const URL="URL";
    private function generateURL(){
        $this->URL = str_replace(" ","_",strip_tags($this->Name)).",";
    }
    public function validate() {
        if(parent::validate()){
            $this->generateURL();
            return true;
        }
        return false;
    }
}
